;- http://clrhome.org/table/

;--------------------- equ -----------------------------------------------------
z80_regs equ $00
z80_f equ $00
z80_a equ $01
z80_af equ z80_f
z80_c equ $02
z80_b equ $03
z80_bc equ z80_c
z80_e equ $04
z80_d equ $05
z80_de equ z80_e
z80_l equ $06
z80_h equ $07
z80_hl equ z80_l
z80_ixl equ $08
z80_ixh equ $09
z80_ix equ $08
z80_iyl equ $0a
z80_iyh equ $0b
z80_iy equ $0a
z80_fp equ $0c
z80_ap equ $0d
z80_cp equ $0e
z80_bp equ $0f
z80_bcp equ z80_cp
z80_ep equ $10
z80_dp equ $11
z80_dep equ z80_ep
z80_lp equ $12
z80_hp equ $13
z80_hlp equ z80_lp
z80_sp  equ $14
z80_reg0 equ $16
z80_reg1 equ $17
z80_reg2 equ $18
z80_reg3 equ $19
z80_reg4 equ $1a
z80_reg5 equ $1b
z80_reg6 equ $1c
z80_reg7 equ $1d
z80_reg8 equ $1e
z80_reg9 equ $1f


;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;--------------------- opcodes -------------------------------------------------

;0x00 - nop
nop

;0x01 - ld bc,nn
lda #<nn     ;- ld bc,nn
sta z80_c
lda #>nn
sta z80_b

;0x02 - ld (bc),nn

;0x03 - inc bc
inc z80_c            ;- inc bc
bne *+4
inc z80_b

;0x04 - inc b
inc z80_b           ;- inc b

;0x05 - dec b
dec z80_b

;0x06 - ld b,n
lda %n               ;- ld b,n
sta z80_b


;0x07 - rlca
asl @ ;- RLCA: Warning: this copies bit 7 to bit 0"

;0x08 - ex af,af'
ldx z80_ap           ;- ex af,af'
sta z80_ap
txa

;0x09 - add hl,bc
lda z80_l            ;- add hl,bc
clc
adc z80_c
sta z80_l
lda z80_h
adc z80_b
sta z80_h

;0x0A - ld a,(bc)
ldy #$00
lda (z80_bc),y

;0x0B - dec bc
lda z80_c              ;- dec bc
bne dec_bc_no_dec_b
dec z80_b
dec_bc_no_dec_b:
dec z80_c
;rts

;0x0C - inc c
inc z80_c     ;- inc c

;0x0D - dec c
dec z80_c     ;- dec c

;0x0E - ld c,n
lda #$%1
sta z80_c

;0x0F - rrca

;0x10 - djnz n
dec z80_b   ;- djnz n
jne n

;0x11 - ld de,nn
lda #<nn             ;- ld de,nn
sta z80_e
lda #>nn
sta z80_d

;0x12 - ld (de),a

;0x13 - inc de
inc z80_e            ;- inc de
bne *+4
inc z80_d

;0x14 - inc d
inc z80_d

;0x15 - dec d
dec z80_d

;0x16 - ld d,n
lda #n        ;- ld d,n
sta z80_d

;0x17 - rla

;0x18 - jr n
jmp n             ;- jr n

;0x19 - add hl,de
clc               ;- add hl,de
lda z80_l
adc z80_e
sta z80_l
lda z80_h
adc z80_d
sta z80_h

;0x1A - ld a,(de)

;0x1B - dec de
;dec_de:
lda z80_e
bne dec_de_no_dec_d
dec z80_d
dec_de_no_dec_d:
dec z80_e
;rts

;0x1C - inc e
inc z80_e

;0x1D - dec e
dec z80_e

;0x1E - ld e,n
lda #$%1
sta z80_e

;0x1F - rra
ror @

;0x20 - jr nz,n
jne %1

;0x21 - ld hl,nn
lda #<nn             ;- ld hl,nn
sta z80_l
lda #>nn
sta z80_h

;0x22 - ld (nn),hl
lda z80_l    ;- ld (nn),hl
sta nn
lda z80_h
sta nn+1

;0x23 - inc hl
inc z80_l            ;- inc hl
bne *+4
inc z80_h

;0x24 - inc h
inc z80_h      ;- inc h

;0x25 - dec h
dec z80_h

;0x26 - ld h,n
lda #$%1
sta z80_h

;0x27 - daa - decimal mode - irrelevant?

;0x28 - jr z,n
jeq n

;0x29 - add hl,hl
asl z80_l            ;- add hl,hl
rol z80_h

;0x2A - ld hl,(nn)
lda nn       ;- ld hl,(nn)
sta z80_l
lda nn+1
sta z80_h

;0x2B - dec hl
dec_hl:
lda z80_l       ;- dec_hl
bne dec_hl_no_dec_h
dec z80_h
dec_hl_no_dec_h:
dec z80_l
;rts

;0x2C - inc l
inc z80_l     ;- inc l

;0x2D - dec l
dec z80_l

;0x2E - ld l,n
lda #$%1
sta z80_l

;0x2F - cpl
eor #$ff     ;- cpl

;0x30 - jr nc,n
jcs %1

;0x31 - ld sp,nn

;0x32 - ld (nn),a
sta %1

;0x33 - inc sp
pla

;0x34 - inc (hl)
ldy #$00           ;- inc (hl)
lda (z80_hl),y
clc
adc #$01
sta (z80_hl),y

;0x35 - dec (hl)
ldy #$00           ;- dec (hl)
lda (z80_hl),y
sec
sbc #$01
sta (z80_hl),y

;0x36 - ld (hl),n
lda #n             ;- ld (hl),n
ldy #$00
sta (z80_hl),y

;0x37 - scf
sec

;0x38 - jr c,n
jcc %n

;0x39 - add hl,sp

;0x3A - ld a,(nn)
lda %1

;0x3B - dec sp
pha

;0x3C - inc a
clc                  ;- inc a
adc #$01

;0x3D - dec a
sec                  ;- dec a
sbc #$01

;0x3E - ld a,n
lda #n               ;- ld a,n

;0x3F - ccf



;0x40 - ld b,b
lda z80_b            ;- ld b,b
sta z80_b

;0x41 - ld b,c
lda z80_c            ;- ld b,c
sta z80_b

;0x42 - ld b,d
lda z80_d            ;- ld b,d
sta z80_b

;0x43 - ld b,e
lda z80_e
sta z80_b

;0x44 - ld b,h
lda z80_h            ;- ld b,h
sta z80_b

;0x45 - ld b,l
lda z80_l            ;- ld b,l
sta z80_b

;0x46 - ld b,(hl)
ldy #$00             ;- ld b,(hl)
lda (z80_hl),y
sta z80_b

;0x47 - ld b,a
lda z80_a            ;- ld b,a
sta z80_b

;0x48 - ld c,b
lda z80_b            ;- ld c,b
sta z80_c

;0x49 - ld c,c
lda z80_c            ;- ld c,c
sta z80_c

;0x4A - ld c,d
lda z80_d            ;- ld c,d
sta z80_c

;0x4B - ld c,e
lda z80_e            ;- ld c,e
sta z80_c

;0x4C - ld c,h
lda z80_h            ;- ld c,h
sta z80_c

;0x4D - ld c,l
lda z80_l            ;- ld c,l
sta z80_c

;0x4E - ld c,(hl)
ldy #$00             ;- ld c,(hl)
lda (z80_hl),y
sta z80_c

;0x4F - ld c,a
lda z80_a            ;- ld c,a
sta z80_c

;0x50 - ld d,b
lda z80_b            ;- ld d,b
sta z80_d

;0x51 - ld d,c
lda z80_c            ;- ld d,c
sta z80_d

;0x52 - ld d,d
lda z80_d            ;-
sta z80_d

;0x53 - ld d,e
lda z80_e            ;-
sta z80_d

;0x54 - ld d,h
lda z80_h            ;- ld d,h
sta z80_d

;0x55 - ld d,l
lda z80_l
sta z80_d

;0x56 - ld d,(hl)
ldy #$00               ;- ld d,(hl)
lda (z80_hl),y
sta z80_d

;0x57 - ld d,a
lda z80_a            ;- ld d,a
sta z80_d

;0x58 - ld e,b
lda z80_b            ;-
sta z80_e

;0x59 - ld e,c
lda z80_c            ;- ld e,c
sta z80_e

;0x5A - ld e,d
lda z80_d            ;-
sta z80_e

;0x5B - ld e,e
lda z80_e            ;-
sta z80_e

;0x5C - ld e,h
lda z80_h            ;- ld e,h
sta z80_e

;0x5D - ld e,l
lda z80_l            ;- ld e,l
sta z80_e

;0x5E - ld e,(hl)
ldy #$00              ;- ld e,(hl)
lda (z80_hl),y
sta z80_e

;0x5F - ld e,a
lda z80_a            ;- ld e,a
sta z80_e

;0x60 - ld h,b
lda z80_b           ;- ld h,b
sta z80_h

;0x61 - ld h,c
lda z80_c           ;- ld h,c
sta z80_h

;0x62 - ld h,d
lda z80_d            ;- ld h,d
sta z80_h

;0x63 - ld h,e
lda z80_e            ;- ld h,e
sta z80_h

;0x64 - ld h,h
lda z80_h            ;- ld h,h
sta z80_h

;0x65 - ld h,l
lda z80_l            ;- ld h,l
sta z80_h

;0x66 - ld h,(hl)
ldy #$00             ;- ld h,(hl)
lda (z80_hl),y
sta z80_h

;0x67 - ld h,a
lda z80_a            ;- ld h,a
sta z80_h


;0x68 - ld l,b
lda z80_b            ;- ld l,b
sta z80_l

;0x69 - ld l,c
lda z80_c            ;- ld l,c
sta z80_l

;0x6A - ld l,d
lda z80_d            ;- ld l,d
sta z80_l

;0x6B - ld l,e
lda z80_e            ;- ld l,e
sta z80_l

;0x6C - ld l,h
lda z80_h            ;- ld l,h
sta z80_l

;0x6D - ld l,l
lda z80_l            ;- ld l,l
sta z80_l

;0x6E - ld l,(hl)
ldy #$00
lda (z80_hl),y
sta z80_l

;0x6F - ld l,a
lda z80_a            ;- ld l,a
sta z80_l



;0x70 - ld (hl),b
lda z80_b            ;- ld (hl),b
ldy #$00
sta (z80_hl),y

;0x71 - ld (hl),c
lda z80_c            ;- ld (hl),c
ldy #$00
sta (z80_hl),y

;0x72 - ld (hl),d
lda z80_d            ;- ld (hl),d
ldy #$00
sta (z80_hl),y

;0x73 - ld (hl),e
lda z80_e            ;- ld (hl),e
ldy #$00
sta (z80_hl),y

;0x74 - ld (hl),h
lda z80_h
ldy #$00
sta (z80_hl),y

;0x75 - ld (hl),l
lda z80_l
ldy #$00
sta (z80_hl),y

;0x76 - ld (hl),(hl)
nop

;0x77 - ld (hl),a
lda z80_a            ;- ld (hl),a
ldy #$00
sta (z80_hl),y

;0x78 - ld a,b
lda z80_b            ;- ld a,b
sta z80_a

;0x79 - ld a,c
lda z80_c            ;- ld a,c
sta z80_a

;0x7A - ld a,d
lda z80_d            ;- ld a,d
sta z80_a

;0x7B - ld a,e
lda z80_e            ;- ld a,e
sta z80_a

;0x7C - ld a,h
lda z80_h            ;- ld a,h
sta z80_a

;0x7D - ld a,l
lda z80_l            ;- ld a,l
sta z80_a

;0x7E - ld a,(hl)
ldy #$00             ;- ld a,(hl)
lda (z80_hl),y
sta z80_a

;0x7F - ld a,a
lda z80_a
sta z80_a

;0x80 - add a,b
clc
adc z80_b

;0x81 - add a,c
clc
adc z80_c

;0x82 - add a,d
clc
adc z80_d

;0x83 - add a,e
clc
adc z80_e

;0x84 - add a,h
clc                ;- add a,h
adc z80_h

;0x85 - add a,l
clc
adc z80_l

;0x86 - add a,(hl)
ldy #$00
clc
adc (z80_hl),y

;0x87 - add a,a
clc                ;- add a,a
adc z80_a

;0x88 - adc a,b
adc z80_b

;0x89 - adc a,c
adc z80_c

;0x8A - adc a,d
adc z80_d

;0x8B - adc a,e
adc z80_e

;0x8C - adc a,h
adc z80_h

;0x8D - adc a,l
adc z80_l

;0x8E - adc a,(hl)

;0x8F - adc a,a
adc z80_a

;0x90 - sub b
sec
sbc z80_b

;0x91 - sub c
sec
sbc z80_c

;0x92 - sub d
sec
sbc z80_d

;0x93 - sub e
sec
sbc z80_e

;0x94 - sub h
sec                ;- sub h
sbc z80_h

;0x95 - sub l
sec                ;- sub l
sbc z80_l

;0x96 - sub (hl)
ldy #$00
sec
sbc (z80_hl),y

;0x97 - sub a
sec
sbc z80_a

;0x98 - sbc a,b
sec
sbc z80_b

;0x99 - sbc a,c
sec
sbc z80_c

;0x9A - sbc a,d
sec
sbc z80_d

;0x9B - sbc a,e
sec
sbc z80_e

;0x9C - sbc a,h
sec
sbc z80_h

;0x9D - sbc a,l
sec
sbc z80_l

;0x9E - sbc a,(hl)

;0x9F - sbc a,a
sec            ;- sbc a,a
sbc z80_a

;0xA0 - and b
and z80_b

;0xA1 - and c
and z80_c

;0xA2 - and d
and z80_d

;0xA3 - and e
and z80_e

;0xA4 - and h
and z80_h

;0xA5 - and l
and z80_l

;0xA6 - and (hl)
ldy #$00
and (z80_hl),y

;0xA7 - and a
and z80_a      ;- and a

;0xA8 - xor b
eor z80_b      ;- xor b

;0xA9 - xor c
eor z80_c      ;- xor c

;0xAA - xor d
eor z80_d      ;- xor d

;0xAB - xor e
eor z80_e      ;- xor e

;0xAC - xor h
eor z80_h      ;- xor h

;0xAD - xor l
eor z80_l             ;- xor l

;0xAE - xor (hl)
ldy #$00
eor (z80_hl),y

;0xAF - xor a
eor z80_a            ;- xor a

;0xB0 - or b
ora z80_b            ;- or b

;0xB1 - or c
ora z80_c            ;- or c

;0xB2 - or d
ora z80_d            ;- or d

;0xB3 - or e
ora z80_e            ;- or e

;0xB4 - or h
ora z80_h            ;- or h

;0xB5 - or l
ora z80_l            ;- or l

;0xB6 - or (hl)
ldy #$00             ;- or (hl)
ora (z80_hl),y

;0xB7 - or a
ora z80_a            ;- or a

;0xB8 - cp b
cmp z80_b            ;- cp b

;0xB9 - cp c
cmp z80_c            ;- cp c

;0xBA - cp d
cmp z80_d

;0xBB - cp e
cmp z80_e

;0xBC - cp h
cmp z80_h

;0xBD - cp l
cmp z80_l            ;- cp l

;0xBE - cp (hl)
ldy #$00             ;- cp (hl)
cmp (z80_hl),y

;0xBF - cp a
cmp z80_a

;0xC0 - ret nz
beq *+3              ;- ret nz
rts

;0xC1 - pop bc
pla                  ;- pop bc
sta z80_b
pla
sta z80_c

;0xC2 - jp nz,nn
jne nn

;0xC3 - jp nn
jmp nn

;0xC4 - call nz,nn
beq *+5              ;- call nz,nn
jsr nn

;0xC5 - push bc
lda z80_c            ;- push bc
pha
lda z80_b
pha

;0xC6 - add a,n
clc
adc #$%1

;0xC7 - rst 00h

;0xC8 - ret z
bne *+3                ;- ret z
rts

;0xC9 - ret
rts            ;- ret

;0xCA - jp z,nn
jeq nn           ;- jp z,nn

;0xCC - call z,nn
bne *+5
jsr %1

;0xCD - call nn
jsr nn

;0xCE - adc a,n

;0xCF - rst 08h

;0xD0 - ret nc
bcc *+3      ;- ret nc
rts

;0xD1 - pop de
pla                      ;- pop de
sta z80_d
pla
sta z80_e

;0xD2 - jp nc,nn
jcs nn      ;- jp nc,nn

;0xD3 - out (n),a

;0xD4 - call nc,nn
bcc *+5
jsr %1

;0xD5 - push de
lda z80_e            ;- push de
pha
lda z80_d
pha

;0xD6 - sub n
sec        ;- sub n
sbc #n

;0xD7 - rst 10h

;0xD8 - ret c
bcs *+3       ;- ret c
rts

;0xD9 - exx
lda z80_c            ;- exx
ldx z80_cp
stx z80_c
sta z80_cp
lda z80_b
ldx z80_bp
stx z80_b
sta z80_bp
lda z80_e
ldx z80_ep
stx z80_e
sta z80_ep
lda z80_d
ldx z80_dp
stx z80_d
sta z80_dp
lda z80_l
ldx z80_lp
stx z80_l
sta z80_lp
lda z80_h
ldx z80_hp
stx z80_h
sta z80_hp



;0xDA - jp c,nn
jcc %1

;0xDB - in a,(n)

;0xDC - call c,nn
bcs *+5
jsr %1

;0xDE - sbc a,n

;0xDF - rst 18h

;0xE0 - ret po

;0xE1 - pop hl
pla                  ;- pop hl
sta z80_h
pla
sta z80_l

;0xE2 - jp po,nn

;0xE3 - ex (sp),hl
tsx             ;- ex (sp),hl
lda $0103,x
ldy z80_h
sta z80_h
tya
sta $0103,x
lda $0104,x
ldy z80_l
sta z80_l
tya
sta $104,x


;0xE4 - call po,nn

;0xE5 - push hl
lda z80_l            ;- push hl
pha
lda z80_h
pha

;0xE6 - and n
and #n               ;- and n

;0xE7 - rst 20h

;0xE8 - ret pe

;0xE9 - jp (hl)
jmp (z80_hl)         ;- jp (hl)

;0xEA - jp pe,nn

;0xEB - ex de,hl
lda z80_e            ;- ex de,hl
ldx z80_l
stx z80_e
sta z80_l
lda z80_d
ldx z80_h
stx z80_d
sta z80_h


;0xEC - call pe,nn

;0xEE - xor n
eor #n               ;- xor n

;0xEF - rst 28h

;0xF0 - ret p
bmi *+3              ;- ret p
rts

;0xF1 - pop af
plp                  ;- pop af
pha

;0xF2 - jp p,nn
jpl %nn

;0xF3 - di

;0xF4 - call p,nn

;0xF5 - push af
pha                  ;- push af
php

;0xF6 - or n
ora #n    ;- or n

;0xF7 - rst 30h

;0xF8 - ret m
bpl *+3               ;- ret m
rts

;0xF9 - ld sp,hl

;0xFA - jp m,nn
jmi %nn                ;- jp m,nn

;0xFB - ei

;0xFC - call m,nn

;0xFE - cp n
cmp #n

;0xFF - rst 38h

;--------------------- extended opcodes - ED -----------------------------------

;0x40 - in b,(c)
;0x41 - out (c),b

;0x42 - sbc hl,bc
lda z80_l     ;- sbc hl,bc
sbc z80_c
sta z80_l
lda z80_h
sbc z80_b
sta z80_h

;0x43 - ld (nn),bc
lda z80_c     ;- ld (nn),bc
sta nn
lda z80_b
sta nn+1

;0x44 - neg
eor #$ff   ;- neg
clc
adc #$01

;0x45 - retn
;0x46 - im0
;0x47 - ld i,a
;0x48 - in c,(c)
;0x49 - out (c),c
;0x4A - adc hl,bc

;0x4B - ld bc,(nn)
lda nn         ;- ld bc,(nn)
sta z80_c
lda nn+1
sta z80_b

;0x4C - neg
eor #$ff   ;- neg
clc
adc #$01

;0x4D - reti
;0x4E - im 0/1
;0x4F - ld r,a

;0x50 - in d,(c)
;0x51 - out (c),d

;0x52 - sbc hl,de
lda z80_l       ;- sbc hl,de
sbc z80_e
sta z80_l
lda z80_h
sbc z80_d
sta z80_h

;0x53 - ld (nn),de
lda z80_e       ;- ld (nn),de
sta nn
lda z80_d
sta nn+1


;0x54 - neg
eor #$ff
clc
adc #$01

;0x55 - retn
;0x56 - im 1
;0x57 - ld a,i
;0x58 - in e,(c)
;0x59 - out (c),e

;0x5A - adc hl,de

;0x5B - ld de,(nn)
lda nn          ;- ld de,(nn)
sta z80_e
lda nn+1
sta z80_d

;0x5C - neg
eor #$ff
clc
adc #$01

;0x5D - retn
;0x5E - im 2
;0x5F - ld a,r

;0x60 - in h,(c)
;0x61 - out (c),h
;0x62 - sbc hl,hl

;0x63 - ld (nn),hl
lda z80_l   ;- ld (nn),hl
sta nn
lda z80_h
sta nn+1

;0x64 - nec

;0x65 - retn
;0x66 - im 0
;0x67 - rrd
;0x68 - in l,(c)
;0x69 - out (c),l

;0x6A - adc hl,hl

;0x6B - ld hl,(nn)
lda nn        ;- ld hl,(nn)
sta z80_l
lda nn+1
sta z80_h


;0x6C - neg
eor #$ff       ;- neg
clc
adc #$01

;0x6D - retn
;0x6E - im 0/1
;0x6F - rld

;0x70 - in (c)
;0x71 - out (c),0
;0x72 - sbc hl,sp
;0x73 - ld (nn),sp
;0x74 - neg
;0x75 - retn
;0x76 - im 1
;0x78 - in a,(c)
;0x79 - out (c),a
;0x7A - adc hl,sp
;0x7B - ld sp,(nn)
;0x7C - neg
;0x7D - retn
;0x7E - im 2

;0xA0 - ldi
;0xA1 - cpi
;0xA2 - ini
;0xA3 - outi
;0xA8 - ldd
;0xA9 - cpd
;0xAA - ind
;0xAB - outd

;0xB0 - ldir

;0xB1 - cpir
;0xB2 - inir
;0xB3 - otir
;0xB8 - lddr
;0xB9 - cpdr
;0xBA - indr
;0xBB - otdr


;-------------------------------------------------------------------------------
;--------------------- extended opcodes - CB -----------------------------------

;0x00 - rlc b
;0x01 - rlc c
;0x02 - rlc d
;0x03 - rlc e
;0x04 - rlc h
;0x05 - rlc l
;0x06 - rlc (hl)
;0x07 - rlc a
;0x08 - rrc b
;0x09 - rrc c
;0x0A - rrc d
;0x0B - rrc e
;0x0C - rrc h
;0x0D - rrc l
;0x0E - rrc (hl)
;0x0F - rrc a

;0x10 - rl b
rol z80_b            ;- rl b

;0x11 - rl c
rol z80_c            ;- rl c

;0x12 - rl d
rol z80_d            ;- rl d

;0x13 - rl e
rol z80_e            ;- rl e

;0x14 - rl h
rol z80_h            ;- rl h

;0x15 - rl l
rol z80_l            ;- rl l

;0x16 - rl (hl)
lda z80_b            ;- rl (hl)
rol a
ldy #$00
sta (z80_hl),y

;0x17 - rl a
rol z80_a            ;- rl a

;0x18 - rr b
ror z80_b            ;- rr b

;0x19 - rr c
ror z80_c            ;- rr c

;0x1A - rr d
ror z80_d            ;- rr d

;0x1B - rr e
ror z80_e            ;- rr e

;0x1C - rr h
ror z80_h            ;- rr h

;0x1D - rr l
ror z80_l            ;- rr l

;0x1E - rr (hl)
lda z80_b            ;- rr (hl)
ror a
ldy #$00
sta (z80_hl),y

;0x1F - rr a
ror z80_a            ;- rr a

;0x20 - sla b
asl z80_b      ;- sla b

;0x21 - sla c
asl z80_c      ;- sla c

;0x22 - sla d
asl z80_d      ;- sla d

;0x23 - sla e
asl z80_e      ;- sla e

;0x24 - sla h
asl z80_h      ;- sla h

;0x25 - sla l
asl z80_l      ;- sla l

;0x26 - sla (hl)
lda (z80_hl)   ;- sla (hl)
asl a
sta (z80_hl)

;0x27 - sla a
asl z80_a      ;- sla a

;0x28 - sra b
;0x29 - sra c
;0x2A - sra d
;0x2B - sra e
;0x2C - sra h
;0x2D - sra l
;0x2E - sra (hl)
;0x2F - sra a

;0x30 - sll b
;0x31 - sll c
;0x32 - sll d
;0x33 - sll e
;0x34 - sll h
;0x35 - sll l
;0x36 - sll (hl)
;0x37 - sll a

;0x38 - srl b
lsr z80_b      ;- srl b

;0x39 - srl c
lsr z80_c      ;- srl c

;0x3A - srl d
lsr z80_d      ;- srl d

;0x3B - srl e
;0x3C - srl h
;0x3D - srl l
;0x3E - srl (hl)
;0x3F - srl a

;0x40 - bit 0,b
lda z80_b       ;- bit 0,b
bit 0

;0x41 - bit 0,c
lda z80_c       ;- bit 0,c
bit 0

;0x42 - bit 0,d
lda z80_d       ;- bit 0,d
bit 0

;0x43 - bit 0,e
lda z80_e       ;- bit 0,e
bit 0

;0x44 - bit 0,h
lda z80_h       ;- bit 0,h
bit 0

;0x45 - bit 0,l
lda z80_l       ;- bit 0,l
bit 0

;0x46 - bit 0,(hl)

;0x47 - bit 0,a
lda z80_a       ;- bit 0,a
bit 0

;0x48 - bit 1,b
;0x49 - bit 1,c
;0x4A - bit 1,d
;0x4B - bit 1,e
;0x4C - bit 1,h
;0x4D - bit 1,l
;0x4E - bit 1,(hl)

;0x4F - bit 1,a
lda z80_a       ;- bit 1,a
bit 1

;0x50 - bit 2 b
;0x51 - bit 2 c
;0x52 - bit 2 d
;0x53 - bit 2 e
;0x54 - bit 2 h
;0x55 - bit 2 l
;0x56 - bit 2 (hl)
;0x57 - bit 2 a
;0x58 - bit 3 b
;0x59 - bit 3 c
;0x5A - bit 3 d
;0x5B - bit 3 e
;0x5C - bit 3 h
;0x5D - bit 3 l
;0x5E - bit 3 (hl)
;0x5F - bit 3 a

;0x60 - bit 4 b
;0x61 - bit 4 c
;0x62 - bit 4 d
;0x63 - bit 4 e
;0x64 - bit 4 h
;0x65 - bit 4 l
;0x66 - bit 4 (hl)
;0x67 - bit 4 a
;0x68 - bit 5 b
;0x69 - bit 5 c
;0x6A - bit 5 d
;0x6B - bit 5 e
;0x6C - bit 5 h
;0x6D - bit 5 l
;0x6E - bit 5 (hl)
;0x6F - bit 5 a

;0x70 - bit 6 b
;0x71 - bit 6 c
;0x72 - bit 6 d
;0x73 - bit 6 e
;0x74 - bit 6 h
;0x75 - bit 6 l
;0x76 - bit 6 (hl)
;0x77 - bit 6 a
;0x78 - bit 7 b
;0x79 - bit 7 c

;0x7A - bit 7,d
lda z80_d       ;- bit 7,d
bit 7

;0x7B - bit 7 e

;0x7C - bit 7 h
lda z80_h       ;- bit 7,h
bit 7

;0x7D - bit 7 l
;0x7E - bit 7 (hl)
;0x7F - bit 7 a



;0x80 - res 0,b
lda z80_b       ;- res 0,b
and #$FF-$01
sta z80_b

;0x81 - res 0 c
lda z80_c       ;- res 0,c
and #$FF-$01
sta z80_c

;0x82 - res 0 d
lda z80_d       ;- res 0,d
and #$FF-$01
sta z80_d

;0x83 - res 0 e
lda z80_e       ;- res 0,e
and #$FF-$01
sta z80_e

;0x84 - res 0 h
lda z80_h       ;- res 0,h
and #$FF-$01
sta z80_h

;0x85 - res 0 l
lda z80_l       ;- res 0,l
and #$FF-$01
sta z80_l

;0x86 - res 0 (hl)

;0x87 - res 0 a
lda z80_a       ;- res 0,a
and #$FF-$01
sta z80_a

;0x88 - res 1 b
lda z80_b       ;- res 1,b
and #$FF-$02
sta z80_b

;0x89 - res 1 c
lda z80_c       ;- res 1,c
and #$FF-$02
sta z80_c

;0x8A - res 1 d
lda z80_d       ;- res 1,d
and #$FF-$02
sta z80_d

;0x8B - res 1 e
lda z80_e       ;- res 1,e
and #$FF-$02
sta z80_e

;0x8C - res 1 h
lda z80_h       ;- res 1,h
and #$FF-$02
sta z80_h

;0x8D - res 1 l
lda z80_l       ;- res 1,l
and #$FF-$02
sta z80_l

;0x8E - res 1 (hl)

;0x8F - res 1 a
lda z80_a       ;- res 1,a
and #$FF-$02
sta z80_a

;0x90 - res 2 b
lda z80_b       ;- res 2,b
and #$FB
sta z80_b

;0x91 - res 2 c
lda z80_c       ;- res 2,c
and #$FB
sta z80_c

;0x92 - res 2 d
lda z80_d       ;- res 2,d
and #$FB
sta z80_d

;0x93 - res 2 e
lda z80_e       ;- res 2,e
and #$FB
sta z80_e

;0x94 - res 2 h
lda z80_h       ;- res 2,h
and #$FB
sta z80_h

;0x95 - res 2 l
lda z80_l       ;- res 2,l
and #$FB
sta z80_l

;0x96 - res 2,(hl)
ldy #$00       ;- res 2,(hl)
lda (z80_hl),y
and #$FB
sta (z80_hl),y


;0x97 - res 2 a
lda z80_a       ;- res 2,a
and #$FB
sta z80_a

;0x98 - res 3 b
lda z80_b       ;- res 3,b
and #$F7
sta z80_b

;0x99 - res 3 c
lda z80_c       ;- res 3,c
and #$F7
sta z80_c

;0x9A - res 3,d
lda z80_d       ;- res 3,d
and #$F7
sta z80_d

;0x9B - res 3,e
lda z80_e       ;- res 3,e
and #$F7
sta z80_e

;0x9C - res 3,h
lda z80_h       ;- res 3,h
and #$F7
sta z80_h

;0x9D - res 3,l
lda z80_l       ;- res 3,l
and #$F7
sta z80_l

;0x9E - res 3,(hl)
ldy #$00       ;- res 3,(hl)
lda (z80_hl),y
and #$F7
sta (z80_hl),y

;0x9F - res 3,a
lda z80_a       ;- res 3,a
and #$F7
sta z80_a

;0xA0 - res 4,b
lda z80_b       ;- res 4,b
and #$EF
sta z80_b

;0xA1 - res 4,c
lda z80_c       ;- res 4,c
and #$EF
sta z80_c

;0xA2 - res 4,d
lda z80_d       ;- res 4,d
and #$EF
sta z80_d

;0xA3 - res 4,e
lda z80_e       ;- res 4,e
and #$EF
sta z80_e

;0xA4 - res 4,h
lda z80_h       ;- res 4,h
and #$EF
sta z80_h

;0xA5 - res 4,l
lda z80_l       ;- res 4,l
and #$EF
sta z80_l

;0xA6 - res 4,(hl)
ldy #$00       ;- res 4,(hl)
lda (z80_hl),y
and #$EF
sta (z80_hl),y

;0xA7 - res 4,a
lda z80_a       ;- res 4,a
and #$EF
sta z80_a

;0xA8 - res 5,b
lda z80_b       ;- res 5,b
and #$DF
sta z80_b

;0xA9 - res 5,c
lda z80_c             ;- res 5,c
and #$DF
sta z80_c

;0xAA - res 5,d
lda z80_d             ;- res 5,d
and #$DF
sta z80_d

;0xAB - res 5,e
lda z80_e             ;- res 5,e
and #$DF
sta z80_e

;0xAC - res 5,h
lda z80_h             ;- res 5,h
and #$DF
sta z80_h

;0xAD - res 5,l
lda z80_l             ;- res 5,l
and #$DF
sta z80_l

;0xAE - res 5,(hl)
ldy #$00             ;- res 5,(hl)
lda (z80_hl),y
and #$DF
sta (z80_hl),y

;0xAF - res 5,a
lda z80_a             ;- res 5,a
and #$DF
sta z80_a

;0xB0 - res 6,b
lda z80_b             ;- res 6,b
and #$FF-$40
sta z80_b

;0xB1 - res 6,c
lda z80_c       ;- res 6,c
and #$FF-$40
sta z80_c

;0xB2 - res 6,d
lda z80_d       ;- res 6,d
and #$FF-$40
sta z80_d

;0xB3 - res 6,e
lda z80_e       ;- res 6,e
and #$FF-$40
sta z80_e

;0xB4 - res 6,h
lda z80_h       ;- res 6,h
and #$FF-$40
sta z80_h

;0xB5 - res 6,l
lda z80_l       ;- res 6,l
and #$FF-$40
sta z80_l

;0xB6 - res 6,(hl)

;0xB7 - res 6,a
lda z80_a       ;- res 6,a
and #$FF-$40
sta z80_a

;0xB8 - res 7,b
lda z80_b       ;- res 7,b
and #$FF-$80
sta z80_b

;0xB9 - res 7,c
lda z80_c       ;- res 7,c
and #$FF-$80
sta z80_c

;0xBA - res 7,d
lda z80_d       ;- res 7,d
and #$FF-$80
sta z80_d

;0xBB - res 7,e
lda z80_e       ;- res 7,e
and #$FF-$80
sta z80_e

;0xBC - res 7,h
lda z80_h       ;- res 7,h
and #$FF-$80
sta z80_h

;0xBD - res 7,l
lda z80_l       ;- res 7,l
and #$FF-$80
sta z80_l

;0xBE - res 7,(hl)

;0xBF - res 7,a
lda z80_a       ;- res 7,a
and #$FF-$80
sta z80_a

;0xC0 - set 0,b
lda z80_b         ;- set 0,b
ora #$01
sta z80_b

;0xC1 - set 0,c
lda z80_c         ;- set 0,c
ora #$01
sta z80_c

;0xC2 - set 0,d
lda z80_d         ;- set 0,d
ora #$01
sta z80_d

;0xC3 - set 0,e
lda z80_e         ;- set 0,e
ora #$01
sta z80_e

;0xC4 - set 0,h
lda z80_h         ;- set 0,h
ora #$01
sta z80_h

;0xC5 - set 0,l
lda z80_l         ;- set 0,l
ora #$01
sta z80_l

;0xC6 - set 0,(hl)
ldy #$00          ;- set 0,(hl)
lda (z80_hl),y
ora #$01
sta (z80_hl),y

;0xC7 - set 0,a
lda z80_a         ;- set 0,a
ora #$01
sta z80_a

;0xC8 - set 1,b
lda z80_b         ;- set 1,b
ora #$02
sta z80_b

;0xC9 - set 1,c
lda z80_c         ;- set 1,c
ora #$02
sta z80_c

;0xCA - set 1,d
lda z80_d         ;- set 1,d
ora #$02
sta z80_d

;0xCB - set 1,e
lda z80_e         ;- set 1,e
ora #$02
sta z80_e

;0xCC - set 1,h
lda z80_h         ;- set 1,h
ora #$02
sta z80_h

;0xCD - set 1,l
lda z80_l         ;- set 1,l
ora #$02
sta z80_l

;0xCE - set 1,(hl)
ldy #$00          ;- set 1,(hl)
lda (z80_hl),y
ora #$02
sta (z80_hl),y

;0xCF - set 1,a
lda z80_a         ;- set 1,a
ora #$02
sta z80_a

;0xD0 - set 2,b
lda z80_b         ;- set 2,b
ora #$04
sta z80_b

;0xD1 - set 2,c
lda z80_c         ;- set 2,c
ora #$04
sta z80_c

;0xD2 - set 2,d
lda z80_d         ;- set 2,d
ora #$04
sta z80_d

;0xD3 - set 2,e
lda z80_e         ;- set 2,e
ora #$04
sta z80_e

;0xD4 - set 2,h
lda z80_h         ;- set 2,h
ora #$04
sta z80_h

;0xD5 - set 2,l
lda z80_l         ;- set 2,l
ora #$04
sta z80_l

;0xD6 - set 2,(hl)
ldy #$00          ;- set 2,(hl)
lda (z80_hl),y
ora #$04
sta (z80_hl),y

;0xD7 - set 2,a
lda z80_a         ;- set 2,a
ora #$04
sta z80_a

;0xD8 - set 3,b
lda z80_b         ;- set 3,b
ora #$08
sta z80_b

;0xD9 - set 3,c
lda z80_c         ;- set 3,c
ora #$08
sta z80_c

;0xDA - set 3,d
lda z80_d         ;- set 3,d
ora #$08
sta z80_d

;0xDB - set 3,e
lda z80_e         ;- set 3,e
ora #$08
sta z80_e

;0xDC - set 3,h
lda z80_h         ;- set 3,h
ora #$08
sta z80_h

;0xDD - set 3,l
lda z80_l         ;- set 3,l
ora #$08
sta z80_l

;0xDE - set 3,(hl)
ldy #$00          ;- set 3,(hl)
lda (z80_hl),y
ora #$08
sta (z80_hl),y

;0xDF - set 3,a
lda z80_a         ;- set 3,a
ora #$08
sta z80_a

;0xE0 - set 4,b
lda z80_b         ;- set 4,b
ora #$10
sta z80_b

;0xE1 - set 4,c
lda z80_c         ;- set 4,c
ora #$10
sta z80_c

;0xE2 - set 4,d
lda z80_d         ;- set 4,d
ora #$10
sta z80_d

;0xE3 - set 4,e
lda z80_e         ;- set 4,e
ora #$10
sta z80_e

;0xE4 - set 4,h
lda z80_h         ;- set 4,h
ora #$10
sta z80_h

;0xE5 - set 4,l
lda z80_l         ;- set 4,l
ora #$10
sta z80_l

;0xE6 - set 4,(hl)
ldy #$00          ;- set 4,(hl)
lda (z80_hl),y
ora #$10
sta (z80_hl),y

;0xE7 - set 4,a
lda z80_a         ;- set 4,a
ora #$10
sta z80_a

;0xE8 - set 5,b
lda z80_b         ;- set 5,b
ora #$20
sta z80_b

;0xE9 - set 5,c
lda z80_c         ;- set 5,c
ora #$20
sta z80_c

;0xEA - set 5,d
lda z80_d         ;- set 5,d
ora #$20
sta z80_d

;0xEB - set 5,e
lda z80_e         ;- set 5,e
ora #$20
sta z80_e

;0xEC - set 5,h
lda z80_h         ;- set 5,h
ora #$20
sta z80_h

;0xED - set 5,l
lda z80_l         ;- set 5,l
ora #$20
sta z80_l

;0xEE - set 5,(hl)
ldy #$00          ;- set 5,(hl)
lda (z80_hl),y
ora #$20
sta (z80_hl),y

;0xEF - set 5,a
lda z80_a         ;- set 5,a
ora #$20
sta z80_a

;0xF0 - set 6,b
lda z80_b         ;- set 6,b
ora #$40
sta z80_b

;0xF1 - set 6,c
lda z80_c         ;- set 6,c
ora #$40
sta z80_c

;0xF2 - set 6,d
lda z80_d         ;- set 6,d
ora #$40
sta z80_d

;0xF3 - set 6,e
lda z80_e         ;- set 6,e
ora #$40
sta z80_e

;0xF4 - set 6,h
lda z80_h         ;- set 6,h
ora #$40
sta z80_h

;0xF5 - set 6,l
lda z80_l         ;- set 6,l
ora #$40
sta z80_l

;0xF6 - set 6,(hl)
ldy #$00          ;- set 6,(hl)
lda (z80_hl),y
ora #$40
sta (z80_hl),y

;0xF7 - set 6,a
lda z80_a         ;- set 6,a
ora #$40
sta z80_a

;0xF8 - set 7,b
lda z80_b         ;- set 7,b
ora #$80
sta z80_b

;0xF9 - set 7,c
lda z80_c         ;- set 7,c
ora #$80
sta z80_c

;0xFA - set 7,d
lda z80_d         ;- set 7,d
ora #$80
sta z80_d

;0xFB - set 7,e
lda z80_e         ;- set 7,e
ora #$80
sta z80_e

;0xFC - set 7,h
lda z80_h         ;- set 7,h
ora #$80
sta z80_h

;0xFD - set 7,l
lda z80_l         ;- set 7,l
ora #$80
sta z80_l

;0xFE - set 7,(hl)
ldy #$00          ;- set 7,(hl)
lda (z80_hl),y
ora #$80
sta (z80_hl),y

;0xFF - set 7,a
lda z80_a         ;- set 7,a
ora #$80
sta z80_a

;--------------------- extended opcodes - DD -----------------------------------

;0x09 - add ix,bc
lda z80_ix        ;- add ix,bc
clc
adc z80_c
sta z80_ix
lda z80_ix+1
adc z80_b
sta z80_ix+1

;0x19 - add ix,de
lda z80_ix        ;- add ix,de
clc
adc z80_e
sta z80_ix
lda z80_ix+1
adc z80_d
sta z80_ix+1

;0x21 - ld ix,nn
lda #<nn            ;- ld ix,nn
sta z80_ix
lda #>nn
sta z80_ix+1

;0x22 - ld (nn),ix
lda z80_ix        ;- ld (nn),hl
sta nn
lda z80_ix+1
sta nn+1


;0x23 - inc ix
inc z80_ix          ;- inc ix
bne *+4
inc z80_ix+1

;0x24 - inc ixh
inc z80_ixh         ;- inc ixh

;0x25 - dec ixh
dec z80_ixh         ;- dec ixh

;0x26 - ld ixh,n
;0x29 - add ix,ix
;0x2A - ld ix,(nn)
;0x2B - dec ix
;0x2C - inc ixl
;0x2D - dec ixl
;0x2E - ld ixl,n

;0x34 - inc (ix+n)
;0x35 - dec (ix+n)
;0x36 - ld (ix+n),n
;0x39 - add ix,sp

;0x44 - ld b,ixh
lda z80_ixh          ;- ld b,ixh
sta z80_b

;0x45 - ld b,ixl
lda z80_ixl          ;- ld b,ixl
sta z80_b

;0x46 - ld b,(ix+n)

;0x4C - ld c,ixh
lda z80_ixh          ;- ld c,ixh
sta z80_c

;0x4D - ld c,ixl
lda z80_ixl          ;- ld c,ixl
sta z80_c

;0x4E - ld c,(ix+n)

;0x54 - ld d,ixh
lda z80_ixh          ;- ld d,ixh
sta z80_d

;0x55 - ld d,ixl
lda z80_ixl          ;- ld d,ixl
sta z80_d

;0x56 - ld d,(ix+n)

;0x5C - ld e,ixh
lda z80_ixh          ;- ld e,ixh
sta z80_e

;0x5D - ld e,ixl
lda z80_ixl          ;- ld e,ixl
sta z80_e

;0x5E - ld e,(ix+n)



;0x60 - ld ixh,b
lda z80_b      ;- ld ixh,b
sta z80_ixh

;0x61 - ld ixh,c
lda z80_c      ;- ld ixh,c
sta z80_ixh

;0x62 - ld ixh,d
lda z80_d      ;- ld ixh,d
sta z80_ixh

;0x63 - ld ixh,e
lda z80_e      ;- ld ixh,e
sta z80_ixh

;0x64 - ld ixh,h
lda z80_h      ;- ld ixh,h
sta z80_ixh

;0x65 - ld ixh,l
lda z80_l      ;- ld ixh,l
sta z80_ixh

;0x66 - ld h,(ix+n)

;0x67 - ld ixh,a
lda z80_a      ;- ld ixh,a
sta z80_ixh


;0x68 - ld ixl,b
lda z80_b      ;- ld ixh,b
sta z80_ixl

;0x69 - ld ixl,c
lda z80_c      ;- ld ixh,c
sta z80_ixl

;0x6A - ld ixl,d
lda z80_d      ;- ld ixh,d
sta z80_ixl

;0x6B - ld ixl,e
lda z80_e      ;- ld ixh,e
sta z80_ixl

;0x6C - ld ixl,h
lda z80_h      ;- ld ixh,h
sta z80_ixl

;0x6D - ld ixl,l
lda z80_l      ;- ld ixh,l
sta z80_ixl

;0x6E - ld l,(ix+n)

;0x6F - ld ixl,a
lda z80_a      ;- ld ixh,a
sta z80_ixl


;0x70 - ld (ix+n),b
;0x71 - ld (ix+n),c
;0x72 - ld (ix+n),d
;0x73 - ld (ix+n),e
;0x74 - ld (ix+n),h
;0x75 - ld (ix+n),l
;0x77 - ld (ix+n),a
;0x7C - ld a,ixh
;0x7D - ld a,ixl
;0x7E - ld a,(ix+n)

;0x84 - add a,ixh
clc            ;- add a,ixh
adc z80_ixh

;0x85 - add a,ixl
;0x86 - add a,(ix+n)
;0x8C - adc a,ixh
;0x8D - adc a,ixl
;0x8E - adc a,(ix+n)

;0x94 - sub ixh
;0x95 - sub ixl
;0x96 - sub (ix+n)
;0x9C - sbc ixh
;0x9D - sbc ixl
;0x9E - sbc (ix+n)

;0xA4 - and ixh
;0xA5 - and ixl
;0xA6 - and (ix+n)
;0xAC - xor ixh
;0xAD - xor ixl
;0xAE - xor (ix+n)

;0xB4 - or ixh
;0xB5 - or ixl
;0xB6 - or (ix+n)
;0xBC - cp ixh
;0xBD - cp ixl
;0xBE - cp (ix+n)

;0xE1 - pop ix
pla                  ;- pop ix
sta z80_ix+1
pla
sta z80_ix

;0xE3 - ex (sp),ix

;0xE5 - push ix
lda z80_ix           ;- push ix
pha
lda z80_ix+1
pha

;0xE9 - jp (ix)

;0xF9 - ld sp,ix

;--------------------- extended opcodes - DD CB --------------------------------

;0x00 - rlc (ix+n),b
;0x01 - rlc (ix+n),c
;0x02 - rlc (ix+n),d
;0x03 - rlc (ix+n),e
;0x04 - rlc (ix+n),h
;0x05 - rlc (ix+n),l
;0x06 - rlc (ix+n)
;0x07 - rlc (ix+n),a
;0x08 - rrc (ix+n),b
;0x09 - rrc (ix+n),c
;0x0A - rrc (ix+n),d
;0x0B - rrc (ix+n),e
;0x0C - rrc (ix+n),h
;0x0D - rrc (ix+n),l
;0x0E - rrc (ix+n)
;0x0F - rrc (ix+n),a

;0x10 - rl (ix+n),b
;0x11 - rl (ix+n),c
;0x12 - rl (ix+n),d
;0x13 - rl (ix+n),e
;0x14 - rl (ix+n),h
;0x15 - rl (ix+n),l
;0x16 - rl (ix+n)
;0x17 - rl (ix+n),a
;0x18 - rr (ix+n),b
;0x19 - rr (ix+n),c
;0x0A - rr (ix+n),d
;0x1B - rr (ix+n),e
;0x1C - rr (ix+n),h
;0x1D - rr (ix+n),l
;0x1E - rr (ix+n)
;0x1F - rr (ix+n),a

;0x20 - sla (ix+n),b
;0x21 - sla (ix+n),c
;0x22 - sla (ix+n),d
;0x23 - sla (ix+n),e
;0x24 - sla (ix+n),h
;0x25 - sla (ix+n),l
;0x26 - sla (ix+n)
;0x27 - sla (ix+n),a
;0x28 - sra (ix+n),b
;0x29 - sra (ix+n),c
;0x2A - sra (ix+n),d
;0x2B - sra (ix+n),e
;0x2C - sra (ix+n),h
;0x2D - sra (ix+n),l
;0x2E - sra (ix+n)
;0x2F - sra (ix+n),a

;0x30 - sll (ix+n),b
;0x31 - sll (ix+n),c
;0x32 - sll (ix+n),d
;0x33 - sll (ix+n),e
;0x34 - sll (ix+n),h
;0x35 - sll (ix+n),l
;0x36 - sll (ix+n)
;0x37 - sll (ix+n),a
;0x38 - srl (ix+n),b
;0x39 - srl (ix+n),c
;0x3A - srl (ix+n),d
;0x3B - srl (ix+n),e
;0x3C - srl (ix+n),h
;0x3D - srl (ix+n),l
;0x3E - srl (ix+n)
;0x3F - srl (ix+n),a




;0x46 - bit 0,(ix+n)
ldy #n            ;- bit 0,(ix+n)
lda (z80_ix),y
bit #$01

;0x4E - bit 1,(ix+n)
ldy #n            ;- bit 1,(ix+n)
lda (z80_ix),y
bit #$02

;0x56 - bit 2,(ix+n)
ldy #n            ;- bit 2,(ix+n)
lda (z80_ix),y
bit #$04

;0x5E - bit 3,(ix+n)
ldy #n            ;- bit 3,(ix+n)
lda (z80_ix),y
bit #$08

;0x66 - bit 4,(ix+n)
ldy #n            ;- bit 4,(ix+n)
lda (z80_ix),y
bit #$10

;0x6E - bit 5,(ix+n)
ldy #n            ;- bit 5,(ix+n)
lda (z80_ix),y
bit #$20

;0x76 - bit 6,(ix+n)
ldy #n            ;- bit 6,(ix+n)
lda (z80_ix),y
bit #$40

;0x7E - bit 7,(ix+n)
ldy #n            ;- bit 7,(ix+n)
lda (z80_ix),y
bit #$80

;0x80 - res 0,(ix+n),b
ldy #n            ;- res 0,(ix+n),b
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_b

;0x81 - res 0,(ix+n),c
ldy #n            ;- res 0,(ix+n),c
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_c

;0x82 - res 0,(ix+n),d
ldy #n            ;- res 0,(ix+n),d
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_d

;0x83 - res 0,(ix+n),e
ldy #n            ;- res 0,(ix+n),e
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_e

;0x84 - res 0,(ix+n),h
ldy #n            ;- res 0,(ix+n),h
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_h

;0x85 - res 0,(ix+n),l
ldy #n            ;- res 0,(ix+n),l
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_l

;0x86 - res 0,(ix+n)
ldy #n            ;- res 0,(ix+n)
lda (z80_ix),y
and #$FE
sta (z80_ix),y

;0x87 - res 0,(ix+n),a
ldy #n            ;- res 0,(ix+n),a
lda (z80_ix),y
and #$FE
sta (z80_ix),y
sta z80_a

;0x88 - res 1,(ix+n),b
ldy #n            ;- res 1,(ix+n),b
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_b

;0x89 - res 1,(ix+n),c
ldy #n            ;- res 1,(ix+n),c
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_c

;0x8A - res 1,(ix+n),d
ldy #n            ;- res 1,(ix+n),d
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_d

;0x8B - res 1,(ix+n),e
ldy #n            ;- res 1,(ix+n),e
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_e

;0x8C - res 1,(ix+n),h
ldy #n            ;- res 1,(ix+n),h
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_h

;0x8D - res 1,(ix+n),l
ldy #n            ;- res 1,(ix+n),l
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_l

;0x8E - res 1,(ix+n)
ldy #n            ;- res 1,(ix+n)
lda (z80_ix),y
and #$FD
sta (z80_ix),y

;0x8F - res 1,(ix+n),a
ldy #n            ;- res 1,(ix+n),a
lda (z80_ix),y
and #$FD
sta (z80_ix),y
sta z80_a


;0x90 - res 2,(ix+n),b
ldy #n            ;- res 2,(ix+n),b
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_b

;0x91 - res 2,(ix+n),c
ldy #n            ;- res 2,(ix+n),c
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_c

;0x92 - res 2,(ix+n),d
ldy #n            ;- res 2,(ix+n),d
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_d

;0x93 - res 2,(ix+n),e
ldy #n            ;- res 2,(ix+n),e
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_e

;0x94 - res 2,(ix+n),h
ldy #n            ;- res 2,(ix+n),h
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_h

;0x95 - res 2,(ix+n),l
ldy #n            ;- res 2,(ix+n),l
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_l

;0x96 - res 2,(ix+n)
ldy #n            ;- res 2,(ix+n)
lda (z80_ix),y
and #$FB
sta (z80_ix),y

;0x97 - res 2,(ix+n),a
ldy #n            ;- res 2,(ix+n),a
lda (z80_ix),y
and #$FB
sta (z80_ix),y
sta z80_a


;0x98 - res 3,(ix+n),b
ldy #n            ;- res 3,(ix+n),b
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_b

;0x99 - res 3,(ix+n),c
ldy #n            ;- res 3,(ix+n),c
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_c

;0x9A - res 3,(ix+n),d
ldy #n            ;- res 3,(ix+n),d
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_d

;0x9B - res 3,(ix+n),e
ldy #n            ;- res 3,(ix+n),e
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_e

;0x9C - res 3,(ix+n),h
ldy #n            ;- res 3,(ix+n),h
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_h

;0x9D - res 3,(ix+n),l
ldy #n            ;- res 3,(ix+n),l
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_l

;0x9E - res 3,(ix+n)
ldy #n            ;- res 3,(ix+n)
lda (z80_ix),y
and #$F7
sta (z80_ix),y

;0x9F - res 3,(ix+n),a
ldy #n            ;- res 3,(ix+n),a
lda (z80_ix),y
and #$F7
sta (z80_ix),y
sta z80_a


;0xA0 - res 4,(ix+n),b
ldy #n            ;- res 4,(ix+n),b
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_b

;0xA1 - res 4,(ix+n),c
ldy #n            ;- res 4,(ix+n),c
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_c

;0xA2 - res 4,(ix+n),d
ldy #n            ;- res 4,(ix+n),d
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_d

;0xA3 - res 4,(ix+n),e
ldy #n            ;- res 4,(ix+n),e
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_e

;0xA4 - res 4,(ix+n),h
ldy #n            ;- res 4,(ix+n),h
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_h

;0xA5 - res 4,(ix+n),l
ldy #n            ;- res 4,(ix+n),l
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_l

;0xA6 - res 4,(ix+n)
ldy #n            ;- res 4,(ix+n)
lda (z80_ix),y
and #$EF
sta (z80_ix),y

;0xA7 - res 4,(ix+n),a
ldy #n            ;- res 4,(ix+n),a
lda (z80_ix),y
and #$EF
sta (z80_ix),y
sta z80_a


;0xA8 - res 5,(ix+n),b
ldy #n            ;- res 5,(ix+n),b
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_b

;0xA9 - res 5,(ix+n),c
ldy #n            ;- res 5,(ix+n),c
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_c

;0xAA - res 5,(ix+n),d
ldy #n            ;- res 5,(ix+n),d
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_d

;0xAB - res 5,(ix+n),e
ldy #n            ;- res 5,(ix+n),e
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_e

;0xAC - res 5,(ix+n),h
ldy #n            ;- res 5,(ix+n),h
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_h

;0xAD - res 5,(ix+n),l
ldy #n            ;- res 5,(ix+n),l
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_l

;0xAE - res 5,(ix+n)
ldy #n            ;- res 5,(ix+n)
lda (z80_ix),y
and #$DF
sta (z80_ix),y

;0xAF - res 5,(ix+n),a
ldy #n            ;- res 5,(ix+n),a
lda (z80_ix),y
and #$DF
sta (z80_ix),y
sta z80_a


;0xB0 - res 6,(ix+n),b
ldy #n            ;- res 6,(ix+n),b
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_b

;0xB1 - res 6,(ix+n),c
ldy #n            ;- res 6,(ix+n),c
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_c

;0xB2 - res 6,(ix+n),d
ldy #n            ;- res 6,(ix+n),d
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_d

;0xB3 - res 6,(ix+n),e
ldy #n            ;- res 6,(ix+n),e
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_e

;0xB4 - res 6,(ix+n),h
ldy #n            ;- res 6,(ix+n),h
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_h

;0xB5 - res 6,(ix+n),l
ldy #n            ;- res 6,(ix+n),l
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_l

;0xB6 - res 6,(ix+n)
ldy #n            ;- res 6,(ix+n)
lda (z80_ix),y
and #$BF
sta (z80_ix),y

;0xB7 - res 6,(ix+n),a
ldy #n            ;- res 6,(ix+n),a
lda (z80_ix),y
and #$BF
sta (z80_ix),y
sta z80_a


;0xB8 - res 7,(ix+n),b
ldy #n            ;- res 7,(ix+n),b
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_b

;0xB9 - res 7,(ix+n),c
ldy #n            ;- res 7,(ix+n),c
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_c

;0xBA - res 7,(ix+n),d
ldy #n            ;- res 7,(ix+n),d
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_d

;0xBB - res 7,(ix+n),e
ldy #n            ;- res 7,(ix+n),e
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_e

;0xBC - res 7,(ix+n),h
ldy #n            ;- res 7,(ix+n),h
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_h

;0xBD - res 7,(ix+n),l
ldy #n            ;- res 7,(ix+n),l
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_l

;0xBE - res 7,(ix+n)
ldy #n            ;- res 7,(ix+n)
lda (z80_ix),y
and #$7F
sta (z80_ix),y

;0xBF - res 7,(ix+n),a
ldy #n            ;- res 7,(ix+n),a
lda (z80_ix),y
and #$7F
sta (z80_ix),y
sta z80_a



;0xC0 - set 0,(ix+n),b
ldy #n              ;- set 0,(ix+n),b
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_b

;0xC1 - set 0,(ix+n),c
ldy #n              ;- set 0,(ix+n),c
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_c

;0xC2 - set 0,(ix+n),d
ldy #n              ;- set 0,(ix+n),d
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_d

;0xC3 - set 0,(ix+n),e
ldy #n              ;- set 0,(ix+n),e
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_e

;0xC4 - set 0,(ix+n),h
ldy #n              ;- set 0,(ix+n),h
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_h

;0xC5 - set 0,(ix+n),l
ldy #n              ;- set 0,(ix+n),l
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_l

;0xC6 - set 0,(ix+n)
ldy #n              ;- set 0,(ix+n)
lda (z80_ix),y
ora $01
sta (z80_ix),y

;0xC7 - set 0,(ix+n),a
ldy #n              ;- set 0,(ix+n),a
lda (z80_ix),y
ora $01
sta (z80_ix),y
sta z80_a

;0xC8 - set 1,(ix+n),b
ldy #n              ;- set 1,(ix+n),b
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_b

;0xC9 - set 1,(ix+n),c
ldy #n              ;- set 1,(ix+n),c
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_c

;0xCA - set 1,(ix+n),d
ldy #n              ;- set 1,(ix+n),d
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_d

;0xCB - set 1,(ix+n),e
ldy #n              ;- set 1,(ix+n),e
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_e

;0xCC - set 1,(ix+n),h
ldy #n              ;- set 1,(ix+n),h
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_h

;0xCD - set 1,(ix+n),l
ldy #n              ;- set 1,(ix+n),l
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_l

;0xCE - set 1,(ix+n)
ldy #n              ;- set 1,(ix+n)
lda (z80_ix),y
ora $02
sta (z80_ix),y

;0xCF - set 1,(ix+n),a
ldy #n              ;- set 1,(ix+n),a
lda (z80_ix),y
ora $02
sta (z80_ix),y
sta z80_a

;0xD0 - set 2,(ix+n),b
ldy #n              ;- set 2,(ix+n),b
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_b

;0xD1 - set 2,(ix+n),c
ldy #n              ;- set 2,(ix+n),c
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_c

;0xD2 - set 2,(ix+n),d
ldy #n              ;- set 2,(ix+n),d
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_d

;0xD3 - set 2,(ix+n),e
ldy #n              ;- set 2,(ix+n),e
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_e

;0xD4 - set 2,(ix+n),h
ldy #n              ;- set 2,(ix+n),h
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_h

;0xD5 - set 2,(ix+n),l
ldy #n              ;- set 2,(ix+n),l
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_l

;0xD6 - set 2,(ix+n)
ldy #n              ;- set 2,(ix+n)
lda (z80_ix),y
ora $04
sta (z80_ix),y

;0xD7 - set 2,(ix+n),a
ldy #n              ;- set 2,(ix+n),a
lda (z80_ix),y
ora $04
sta (z80_ix),y
sta z80_a

;0xD8 - set 3,(ix+n),b
ldy #n              ;- set 3,(ix+n),b
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_b

;0xD9 - set 3,(ix+n),c
ldy #n              ;- set 3,(ix+n),c
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_c

;0xDA - set 3,(ix+n),d
ldy #n              ;- set 3,(ix+n),d
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_d

;0xDB - set 3,(ix+n),e
ldy #n              ;- set 3,(ix+n),e
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_e

;0xDC - set 3,(ix+n),h
ldy #n              ;- set 3,(ix+n),h
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_h

;0xDD - set 3,(ix+n),l
ldy #n              ;- set 3,(ix+n),l
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_l

;0xDE - set 3,(ix+n)
ldy #n              ;- set 3,(ix+n)
lda (z80_ix),y
ora $08
sta (z80_ix),y

;0xDF - set 3,(ix+n),a
ldy #n              ;- set 3,(ix+n),a
lda (z80_ix),y
ora $08
sta (z80_ix),y
sta z80_a

;0xE0 - set 4,(ix+n),b
ldy #n              ;- set 4,(ix+n),b
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_b

;0xE1 - set 4,(ix+n),c
ldy #n              ;- set 4,(ix+n),c
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_c

;0xE2 - set 4,(ix+n),d
ldy #n              ;- set 4,(ix+n),d
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_d

;0xE3 - set 4,(ix+n),e
ldy #n              ;- set 4,(ix+n),e
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_e

;0xE4 - set 4,(ix+n),h
ldy #n              ;- set 4,(ix+n),h
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_h

;0xE5 - set 4,(ix+n),l
ldy #n              ;- set 4,(ix+n),l
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_l

;0xE6 - set 4,(ix+n)
ldy #n              ;- set 4,(ix+n)
lda (z80_ix),y
ora $10
sta (z80_ix),y

;0xE7 - set 4,(ix+n),a
ldy #n              ;- set 4,(ix+n),a
lda (z80_ix),y
ora $10
sta (z80_ix),y
sta z80_a

;0xE8 - set 5,(ix+n),b
ldy #n              ;- set 5,(ix+n),b
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_b

;0xE9 - set 5,(ix+n),c
ldy #n              ;- set 5,(ix+n),c
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_c

;0xEA - set 5,(ix+n),d
ldy #n              ;- set 5,(ix+n),d
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_d

;0xEB - set 5,(ix+n),e
ldy #n              ;- set 5,(ix+n),e
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_e

;0xEC - set 5,(ix+n),h
ldy #n              ;- set 5,(ix+n),h
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_h

;0xED - set 5,(ix+n),l
ldy #n              ;- set 5,(ix+n),l
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_l

;0xEE - set 5,(ix+n)
ldy #n              ;- set 5,(ix+n)
lda (z80_ix),y
ora $20
sta (z80_ix),y

;0xEF - set 5,(ix+n),a
ldy #n              ;- set 5,(ix+n),a
lda (z80_ix),y
ora $20
sta (z80_ix),y
sta z80_a

;0xF0 - set 6,(ix+n),b
ldy #n              ;- set 6,(ix+n),b
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_b

;0xF1 - set 6,(ix+n),c
ldy #n              ;- set 6,(ix+n),c
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_c

;0xF2 - set 6,(ix+n),d
ldy #n              ;- set 6,(ix+n),d
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_d

;0xF3 - set 6,(ix+n),e
ldy #n              ;- set 6,(ix+n),e
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_e

;0xF4 - set 6,(ix+n),h
ldy #n              ;- set 6,(ix+n),h
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_h

;0xF5 - set 6,(ix+n),l
ldy #n              ;- set 6,(ix+n),l
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_l

;0xF6 - set 6,(ix+n)
ldy #n              ;- set 6,(ix+n)
lda (z80_ix),y
ora $40
sta (z80_ix),y

;0xF7 - set 6,(ix+n),a
ldy #n              ;- set 6,(ix+n),a
lda (z80_ix),y
ora $40
sta (z80_ix),y
sta z80_a

;0xF8 - set 7,(ix+n),b
ldy #n              ;- set 7,(ix+n),b
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_b

;0xF9 - set 7,(ix+n),c
ldy #n              ;- set 7,(ix+n),c
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_c

;0xFA - set 7,(ix+n),d
ldy #n              ;- set 7,(ix+n),d
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_d

;0xFB - set 7,(ix+n),e
ldy #n              ;- set 7,(ix+n),e
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_e

;0xFC - set 7,(ix+n),h
ldy #n              ;- set 7,(ix+n),h
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_h

;0xFD - set 7,(ix+n),l
ldy #n              ;- set 7,(ix+n),l
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_l

;0xFE - set 7,(ix+n)
ldy #n              ;- set 7,(ix+n)
lda (z80_ix),y
ora $80
sta (z80_ix),y

;0xFF - set 7,(ix+n),a
ldy #n              ;- set 7,(ix+n),a
lda (z80_ix),y
ora $80
sta (z80_ix),y
sta z80_a

;--------------------- extended opcodes - FD -----------------------------------

;0x09 - add iy,bc
;0x19 - add iy,de

;0x21 - ld iy,nn
;0x22 - ld (nn),iy
;0x23 - inc iy
;0x24 - inc iyh
;0x25 - dec iyh
;0x26 - ld iyh,n
;0x29 - add iy,iy
;0x2A - ld iy,(nn)
;0x2B - dec iy
;0x2C - inc iyl
;0x2D - dec iyl
;0x2E - ld iyl,n

;0x34 - inc (iy+n)
;0x35 - dec (iy+n)
;0x36 - ld (iy+n),n
;0x39 - add iy,sp

;0x44 - ld b,iyh
;0x45 - ld b,iyl
;0x46 - ld b,(iy+n)
;0x4C - ld c,iyh
;0x4D - ld c,iyl
;0x4E - ld c,(iy+n)

;0x54 - ld d,iyh
;0x55 - ld d,iyl
;0x56 - ld d,(iy+n)
;0x5C - ld e,iyh
;0x5D - ld e,iyl
;0x5E - ld e,(iy+n)

;0x60 - ld iyh,b
;0x61 - ld iyh,c
;0x62 - ld iyh,d
;0x63 - ld iyh,e
;0x64 - ld iyh,h
;0x65 - ld iyh,l
;0x66 - ld h,(iy+n)
;0x67 - ld iyh,a
;0x68 - ld iyl,b
;0x69 - ld iyl,c
;0x6A - ld iyl,d
;0x6B - ld iyl,e
;0x6C - ld iyl,h
;0x6D - ld iyl,l
;0x6E - ld l,(iy+n)
;0x6F - ld iyl,a

;0x70 - ld (iy+n),b
;0x71 - ld (iy+n),c
;0x72 - ld (iy+n),d
;0x73 - ld (iy+n),e
;0x74 - ld (iy+n),h
;0x75 - ld (iy+n),l
;0x77 - ld (iy+n),a
;0x7C - ld a,iyh
;0x7D - ld a,iyl
;0x7E - ld a,(iy+n)

;0x84 - add a,iyh
;0x85 - add a,iyl
;0x86 - add a,(iy+n)
;0x8C - adc a,iyh
;0x8D - adc a,iyl
;0x8E - adc a,(iy+n)

;0x94 - sub iyh
;0x95 - sub iyl
;0x96 - sub (iy+n)
;0x9C - sbc iyh
;0x9D - sbc iyl
;0x9E - sbc (iy+n)

;0xA4 - and iyh
;0xA5 - and iyl
;0xA6 - and (iy+n)
;0xAC - xor iyh
;0xAD - xor iyl
;0xAE - xor (iy+n)

;0xB4 - or iyh
;0xB5 - or iyl
;0xB6 - or (iy+n)
;0xBC - cp iyh
;0xBD - cp iyl
;0xBE - cp (iy+n)

;0xE1 - pop iy
;0xE3 - ex (sp),iy

;0xE5 - push iy
lda z80_iy          ;- push iy
pha
lda z80_iy+1
pha

;0xE9 - jp (iy)

;0xF9 - ld sp,iy

;--------------------- extended opcodes - FD CB --------------------------------

;0x00 - rlc (iy+n),b
;0x01 - rlc (iy+n),c
;0x02 - rlc (iy+n),d
;0x03 - rlc (iy+n),e
;0x04 - rlc (iy+n),h
;0x05 - rlc (iy+n),l
;0x06 - rlc (iy+n)
;0x07 - rlc (iy+n),a
;0x08 - rrc (iy+n),b
;0x09 - rrc (iy+n),c
;0x0A - rrc (iy+n),d
;0x0B - rrc (iy+n),e
;0x0C - rrc (iy+n),h
;0x0D - rrc (iy+n),l
;0x0E - rrc (iy+n)
;0x0F - rrc (iy+n),a

;0x10 - rl (iy+n),b
;0x11 - rl (iy+n),c
;0x12 - rl (iy+n),d
;0x13 - rl (iy+n),e
;0x14 - rl (iy+n),h
;0x15 - rl (iy+n),l
;0x16 - rl (iy+n)
;0x17 - rl (iy+n),a
;0x18 - rr (iy+n),b
;0x19 - rr (iy+n),c
;0x0A - rr (iy+n),d
;0x1B - rr (iy+n),e
;0x1C - rr (iy+n),h
;0x1D - rr (iy+n),l
;0x1E - rr (iy+n)
;0x1F - rr (iy+n),a

;0x20 - sla (iy+n),b
;0x21 - sla (iy+n),c
;0x22 - sla (iy+n),d
;0x23 - sla (iy+n),e
;0x24 - sla (iy+n),h
;0x25 - sla (iy+n),l
;0x26 - sla (iy+n)
;0x27 - sla (iy+n),a
;0x28 - sra (iy+n),b
;0x29 - sra (iy+n),c
;0x2A - sra (iy+n),d
;0x2B - sra (iy+n),e
;0x2C - sra (iy+n),h
;0x2D - sra (iy+n),l
;0x2E - sra (iy+n)
;0x2F - sra (iy+n),a

;0x30 - sll (iy+n),b
;0x31 - sll (iy+n),c
;0x32 - sll (iy+n),d
;0x33 - sll (iy+n),e
;0x34 - sll (iy+n),h
;0x35 - sll (iy+n),l
;0x36 - sll (iy+n)
;0x37 - sll (iy+n),a
;0x38 - srl (iy+n),b
;0x39 - srl (iy+n),c
;0x3A - srl (iy+n),d
;0x3B - srl (iy+n),e
;0x3C - srl (iy+n),h
;0x3D - srl (iy+n),l
;0x3E - srl (iy+n)
;0x3F - srl (iy+n),a



;0x46 - bit 0,(iy+n)
ldy #n            ;- bit 0,(iy+n)
lda (z80_iy),y
bit #$01

;0x4E - bit 1,(iy+n)
ldy #n            ;- bit 1,(iy+n)
lda (z80_iy),y
bit #$02

;0x56 - bit 2,(iy+n)
ldy #n            ;- bit 2,(iy+n)
lda (z80_iy),y
bit #$04

;0x5E - bit 3,(iy+n)
ldy #n            ;- bit 3,(iy+n)
lda (z80_iy),y
bit #$08

;0x66 - bit 4,(iy+n)
ldy #n            ;- bit 4,(iy+n)
lda (z80_iy),y
bit #$10

;0x6E - bit 5,(iy+n)
ldy #n            ;- bit 5,(iy+n)
lda (z80_iy),y
bit #$20

;0x76 - bit 6,(iy+n)
ldy #n            ;- bit 6,(iy+n)
lda (z80_iy),y
bit #$40

;0x7E - bit 7,(iy+n)
ldy #n            ;- bit 7,(iy+n)
lda (z80_iy),y
bit #$80



;0x80 - res 0,(iy+n),b
ldy #n            ;- res 0,(iy+n),b
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_b

;0x81 - res 0,(iy+n),c
ldy #n            ;- res 0,(iy+n),c
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_c

;0x82 - res 0,(iy+n),d
ldy #n            ;- res 0,(iy+n),d
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_d

;0x83 - res 0,(iy+n),e
ldy #n            ;- res 0,(iy+n),e
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_e

;0x84 - res 0,(iy+n),h
ldy #n            ;- res 0,(iy+n),h
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_h

;0x85 - res 0,(iy+n),l
ldy #n            ;- res 0,(iy+n),l
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_l

;0x86 - res 0,(iy+n)
ldy #n            ;- res 0,(iy+n)
lda (z80_iy),y
and #$FE
sta (z80_iy),y

;0x87 - res 0,(iy+n),a
ldy #n            ;- res 0,(iy+n),a
lda (z80_iy),y
and #$FE
sta (z80_iy),y
sta z80_a

;0x88 - res 1,(iy+n),b
ldy #n            ;- res 1,(iy+n),b
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_b

;0x89 - res 1,(iy+n),c
ldy #n            ;- res 1,(iy+n),c
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_c

;0x8A - res 1,(iy+n),d
ldy #n            ;- res 1,(iy+n),d
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_d

;0x8B - res 1,(iy+n),e
ldy #n            ;- res 1,(iy+n),e
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_e

;0x8C - res 1,(iy+n),h
ldy #n            ;- res 1,(iy+n),h
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_h

;0x8D - res 1,(iy+n),l
ldy #n            ;- res 1,(iy+n),l
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_l

;0x8E - res 1,(iy+n)
ldy #n            ;- res 1,(iy+n)
lda (z80_iy),y
and #$FD
sta (z80_iy),y

;0x8F - res 1,(iy+n),a
ldy #n            ;- res 1,(iy+n),a
lda (z80_iy),y
and #$FD
sta (z80_iy),y
sta z80_a


;0x90 - res 2,(iy+n),b
ldy #n            ;- res 2,(iy+n),b
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_b

;0x91 - res 2,(iy+n),c
ldy #n            ;- res 2,(iy+n),c
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_c

;0x92 - res 2,(iy+n),d
ldy #n            ;- res 2,(iy+n),d
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_d

;0x93 - res 2,(iy+n),e
ldy #n            ;- res 2,(iy+n),e
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_e

;0x94 - res 2,(iy+n),h
ldy #n            ;- res 2,(iy+n),h
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_h

;0x95 - res 2,(iy+n),l
ldy #n            ;- res 2,(iy+n),l
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_l

;0x96 - res 2,(iy+n)
ldy #n            ;- res 2,(iy+n)
lda (z80_iy),y
and #$FB
sta (z80_iy),y

;0x97 - res 2,(iy+n),a
ldy #n            ;- res 2,(iy+n),a
lda (z80_iy),y
and #$FB
sta (z80_iy),y
sta z80_a


;0x98 - res 3,(iy+n),b
ldy #n            ;- res 3,(iy+n),b
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_b

;0x99 - res 3,(iy+n),c
ldy #n            ;- res 3,(iy+n),c
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_c

;0x9A - res 3,(iy+n),d
ldy #n            ;- res 3,(iy+n),d
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_d

;0x9B - res 3,(iy+n),e
ldy #n            ;- res 3,(iy+n),e
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_e

;0x9C - res 3,(iy+n),h
ldy #n            ;- res 3,(iy+n),h
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_h

;0x9D - res 3,(iy+n),l
ldy #n            ;- res 3,(iy+n),l
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_l

;0x9E - res 3,(iy+n)
ldy #n            ;- res 3,(iy+n)
lda (z80_iy),y
and #$F7
sta (z80_iy),y

;0x9F - res 3,(iy+n),a
ldy #n            ;- res 3,(iy+n),a
lda (z80_iy),y
and #$F7
sta (z80_iy),y
sta z80_a


;0xA0 - res 4,(iy+n),b
ldy #n            ;- res 4,(iy+n),b
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_b

;0xA1 - res 4,(iy+n),c
ldy #n            ;- res 4,(iy+n),c
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_c

;0xA2 - res 4,(iy+n),d
ldy #n            ;- res 4,(iy+n),d
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_d

;0xA3 - res 4,(iy+n),e
ldy #n            ;- res 4,(iy+n),e
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_e

;0xA4 - res 4,(iy+n),h
ldy #n            ;- res 4,(iy+n),h
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_h

;0xA5 - res 4,(iy+n),l
ldy #n            ;- res 4,(iy+n),l
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_l

;0xA6 - res 4,(iy+n)
ldy #n            ;- res 4,(iy+n)
lda (z80_iy),y
and #$EF
sta (z80_iy),y

;0xA7 - res 4,(iy+n),a
ldy #n            ;- res 4,(iy+n),a
lda (z80_iy),y
and #$EF
sta (z80_iy),y
sta z80_a


;0xA8 - res 5,(iy+n),b
ldy #n            ;- res 5,(iy+n),b
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_b

;0xA9 - res 5,(iy+n),c
ldy #n            ;- res 5,(iy+n),c
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_c

;0xAA - res 5,(iy+n),d
ldy #n            ;- res 5,(iy+n),d
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_d

;0xAB - res 5,(iy+n),e
ldy #n            ;- res 5,(iy+n),e
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_e

;0xAC - res 5,(iy+n),h
ldy #n            ;- res 5,(iy+n),h
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_h

;0xAD - res 5,(iy+n),l
ldy #n            ;- res 5,(iy+n),l
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_l

;0xAE - res 5,(iy+n)
ldy #n            ;- res 5,(iy+n)
lda (z80_iy),y
and #$DF
sta (z80_iy),y

;0xAF - res 5,(iy+n),a
ldy #n            ;- res 5,(iy+n),a
lda (z80_iy),y
and #$DF
sta (z80_iy),y
sta z80_a


;0xB0 - res 6,(iy+n),b
ldy #n            ;- res 6,(iy+n),b
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_b

;0xB1 - res 6,(iy+n),c
ldy #n            ;- res 6,(iy+n),c
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_c

;0xB2 - res 6,(iy+n),d
ldy #n            ;- res 6,(iy+n),d
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_d

;0xB3 - res 6,(iy+n),e
ldy #n            ;- res 6,(iy+n),e
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_e

;0xB4 - res 6,(iy+n),h
ldy #n            ;- res 6,(iy+n),h
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_h

;0xB5 - res 6,(iy+n),l
ldy #n            ;- res 6,(iy+n),l
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_l

;0xB6 - res 6,(iy+n)
ldy #n            ;- res 6,(iy+n)
lda (z80_iy),y
and #$BF
sta (z80_iy),y

;0xB7 - res 6,(iy+n),a
ldy #n            ;- res 6,(iy+n),a
lda (z80_iy),y
and #$BF
sta (z80_iy),y
sta z80_a


;0xB8 - res 7,(iy+n),b
ldy #n            ;- res 7,(iy+n),b
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_b

;0xB9 - res 7,(iy+n),c
ldy #n            ;- res 7,(iy+n),c
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_c

;0xBA - res 7,(iy+n),d
ldy #n            ;- res 7,(iy+n),d
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_d

;0xBB - res 7,(iy+n),e
ldy #n            ;- res 7,(iy+n),e
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_e

;0xBC - res 7,(iy+n),h
ldy #n            ;- res 7,(iy+n),h
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_h

;0xBD - res 7,(iy+n),l
ldy #n            ;- res 7,(iy+n),l
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_l

;0xBE - res 7,(iy+n)
ldy #n            ;- res 7,(iy+n)
lda (z80_iy),y
and #$7F
sta (z80_iy),y

;0xBF - res 7,(iy+n),a
ldy #n            ;- res 7,(iy+n),a
lda (z80_iy),y
and #$7F
sta (z80_iy),y
sta z80_a



;0xC0 - set 0,(iy+n),b
ldy #n              ;- set 0,(iy+n),b
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_b

;0xC1 - set 0,(iy+n),c
ldy #n              ;- set 0,(iy+n),c
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_c

;0xC2 - set 0,(iy+n),d
ldy #n              ;- set 0,(iy+n),d
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_d

;0xC3 - set 0,(iy+n),e
ldy #n              ;- set 0,(iy+n),e
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_e

;0xC4 - set 0,(iy+n),h
ldy #n              ;- set 0,(iy+n),h
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_h

;0xC5 - set 0,(iy+n),l
ldy #n              ;- set 0,(iy+n),l
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_l

;0xC6 - set 0,(iy+n)
ldy #n              ;- set 0,(iy+n)
lda (z80_iy),y
ora $01
sta (z80_iy),y

;0xC7 - set 0,(iy+n),a
ldy #n              ;- set 0,(iy+n),a
lda (z80_iy),y
ora $01
sta (z80_iy),y
sta z80_a

;0xC8 - set 1,(iy+n),b
ldy #n              ;- set 1,(iy+n),b
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_b

;0xC9 - set 1,(iy+n),c
ldy #n              ;- set 1,(iy+n),c
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_c

;0xCA - set 1,(iy+n),d
ldy #n              ;- set 1,(iy+n),d
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_d

;0xCB - set 1,(iy+n),e
ldy #n              ;- set 1,(iy+n),e
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_e

;0xCC - set 1,(iy+n),h
ldy #n              ;- set 1,(iy+n),h
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_h

;0xCD - set 1,(iy+n),l
ldy #n              ;- set 1,(iy+n),l
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_l

;0xCE - set 1,(iy+n)
ldy #n              ;- set 1,(iy+n)
lda (z80_iy),y
ora $02
sta (z80_iy),y

;0xCF - set 1,(iy+n),a
ldy #n              ;- set 1,(iy+n),a
lda (z80_iy),y
ora $02
sta (z80_iy),y
sta z80_a

;0xD0 - set 2,(iy+n),b
ldy #n              ;- set 2,(iy+n),b
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_b

;0xD1 - set 2,(iy+n),c
ldy #n              ;- set 2,(iy+n),c
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_c

;0xD2 - set 2,(iy+n),d
ldy #n              ;- set 2,(iy+n),d
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_d

;0xD3 - set 2,(iy+n),e
ldy #n              ;- set 2,(iy+n),e
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_e

;0xD4 - set 2,(iy+n),h
ldy #n              ;- set 2,(iy+n),h
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_h

;0xD5 - set 2,(iy+n),l
ldy #n              ;- set 2,(iy+n),l
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_l

;0xD6 - set 2,(iy+n)
ldy #n              ;- set 2,(iy+n)
lda (z80_iy),y
ora $04
sta (z80_iy),y

;0xD7 - set 2,(iy+n),a
ldy #n              ;- set 2,(iy+n),a
lda (z80_iy),y
ora $04
sta (z80_iy),y
sta z80_a

;0xD8 - set 3,(iy+n),b
ldy #n              ;- set 3,(iy+n),b
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_b

;0xD9 - set 3,(iy+n),c
ldy #n              ;- set 3,(iy+n),c
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_c

;0xDA - set 3,(iy+n),d
ldy #n              ;- set 3,(iy+n),d
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_d

;0xDB - set 3,(iy+n),e
ldy #n              ;- set 3,(iy+n),e
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_e

;0xDC - set 3,(iy+n),h
ldy #n              ;- set 3,(iy+n),h
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_h

;0xDD - set 3,(iy+n),l
ldy #n              ;- set 3,(iy+n),l
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_l

;0xDE - set 3,(iy+n)
ldy #n              ;- set 3,(iy+n)
lda (z80_iy),y
ora $08
sta (z80_iy),y

;0xDF - set 3,(iy+n),a
ldy #n              ;- set 3,(iy+n),a
lda (z80_iy),y
ora $08
sta (z80_iy),y
sta z80_a

;0xE0 - set 4,(iy+n),b
ldy #n              ;- set 4,(iy+n),b
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_b

;0xE1 - set 4,(iy+n),c
ldy #n              ;- set 4,(iy+n),c
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_c

;0xE2 - set 4,(iy+n),d
ldy #n              ;- set 4,(iy+n),d
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_d

;0xE3 - set 4,(iy+n),e
ldy #n              ;- set 4,(iy+n),e
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_e

;0xE4 - set 4,(iy+n),h
ldy #n              ;- set 4,(iy+n),h
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_h

;0xE5 - set 4,(iy+n),l
ldy #n              ;- set 4,(iy+n),l
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_l

;0xE6 - set 4,(iy+n)
ldy #n              ;- set 4,(iy+n)
lda (z80_iy),y
ora $10
sta (z80_iy),y

;0xE7 - set 4,(iy+n),a
ldy #n              ;- set 4,(iy+n),a
lda (z80_iy),y
ora $10
sta (z80_iy),y
sta z80_a

;0xE8 - set 5,(iy+n),b
ldy #n              ;- set 5,(iy+n),b
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_b

;0xE9 - set 5,(iy+n),c
ldy #n              ;- set 5,(iy+n),c
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_c

;0xEA - set 5,(iy+n),d
ldy #n              ;- set 5,(iy+n),d
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_d

;0xEB - set 5,(iy+n),e
ldy #n              ;- set 5,(iy+n),e
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_e

;0xEC - set 5,(iy+n),h
ldy #n              ;- set 5,(iy+n),h
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_h

;0xED - set 5,(iy+n),l
ldy #n              ;- set 5,(iy+n),l
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_l

;0xEE - set 5,(iy+n)
ldy #n              ;- set 5,(iy+n)
lda (z80_iy),y
ora $20
sta (z80_iy),y

;0xEF - set 5,(iy+n),a
ldy #n              ;- set 5,(iy+n),a
lda (z80_iy),y
ora $20
sta (z80_iy),y
sta z80_a

;0xF0 - set 6,(iy+n),b
ldy #n              ;- set 6,(iy+n),b
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_b

;0xF1 - set 6,(iy+n),c
ldy #n              ;- set 6,(iy+n),c
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_c

;0xF2 - set 6,(iy+n),d
ldy #n              ;- set 6,(iy+n),d
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_d

;0xF3 - set 6,(iy+n),e
ldy #n              ;- set 6,(iy+n),e
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_e

;0xF4 - set 6,(iy+n),h
ldy #n              ;- set 6,(iy+n),h
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_h

;0xF5 - set 6,(iy+n),l
ldy #n              ;- set 6,(iy+n),l
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_l

;0xF6 - set 6,(iy+n)
ldy #n              ;- set 6,(iy+n)
lda (z80_iy),y
ora $40
sta (z80_iy),y

;0xF7 - set 6,(iy+n),a
ldy #n              ;- set 6,(iy+n),a
lda (z80_iy),y
ora $40
sta (z80_iy),y
sta z80_a

;0xF8 - set 7,(iy+n),b
ldy #n              ;- set 7,(iy+n),b
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_b

;0xF9 - set 7,(iy+n),c
ldy #n              ;- set 7,(iy+n),c
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_c

;0xFA - set 7,(iy+n),d
ldy #n              ;- set 7,(iy+n),d
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_d

;0xFB - set 7,(iy+n),e
ldy #n              ;- set 7,(iy+n),e
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_e

;0xFC - set 7,(iy+n),h
ldy #n              ;- set 7,(iy+n),h
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_h

;0xFD - set 7,(iy+n),l
ldy #n              ;- set 7,(iy+n),l
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_l

;0xFE - set 7,(iy+n)
ldy #n              ;- set 7,(iy+n)
lda (z80_iy),y
ora $80
sta (z80_iy),y

;0xFF - set 7,(iy+n),a
ldy #n              ;- set 7,(iy+n),a
lda (z80_iy),y
ora $80
sta (z80_iy),y
sta z80_a

;---------------------------------------------------


